/*
 * @Author: your name
 * @Date: 2024-05-06 20:52:07
 * @LastEditTime: 2024-05-06 20:56:54
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \.leetcode\77.组合.cpp
 */
/*
 * @lc app=leetcode.cn id=77 lang=cpp
 *
 * [77] 组合
 */

// @lc code=start
class Solution {
public:
    vector<vector<int>> res;
    vector<int>path;
    void backtracking(int n, int k, int startIndex){
        if(path.size() == k){
            res.push_back(path);
            return;
        }
        for(int i = startIndex; i <= n; i++){
            path.push_back(i);
            backtracking(n, k, i+1);
            path.pop_back();
        }

    }
    vector<vector<int>> combine(int n, int k) {
        backtracking(n, k , 1);
        return res;
    }
};
// @lc code=end

